import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { IndexScreenNavigationProp } from '../navigation/types';

function IndexScreen() {
  // 使用集中定义的导航类型
  const navigation = useNavigation<IndexScreenNavigationProp>();

  return (
    <View style={styles.container}>
      <Text style={styles.title}>首页</Text>
      <Button
        title="跳转到演示页面"
        onPress={() => navigation.navigate('Demo')}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    padding: 20,
  },
  title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 20,
  },
});

export default IndexScreen; 